package com.ranshiyan.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.ranshiyan.entity.Area;
import com.ranshiyan.entity.Student;
import com.ranshiyan.entity.Subject;

public interface StuMapper {

	//查询列表12
	List<Student> listStudent();
	
	//查询所有课程1
	List<Subject> listsubject();
	
	//下拉框地址
	@Select("select * from stu_area where parentId=#{value}")
	List<Area> listArea(int id);
	
	//添加主表
	int addstudent(Student student);
	
	//添加中间表
	int addstusub(@Param("sd")int sd,@Param("sb")int sb);
	
	//学生表回显
	Student findStudent(int id);
	
	
	//修改学生表
	@Update("UPDATE stu_students SET `name`=#{name},enter_date=#{enterDate},province_id=#{provinceId},city_id=#{cityId},county_id=#{countryId} WHERE id=#{id}")
	void updateStudent(Student student);
	
	
	@Delete("DELETE FROM stu_student_subject WHERE id=#{subjectId}")
	void deletestusub(int subjectId);
	
	//删除中间表
	void deletestusubs(int[] id);
}
